﻿@using JA.UTILS.Helpers

<!--Cannot use Razor in js files ! (An alternative: http://www.nuget.org/packages/RazorJS)-->
@*
    Those functions must be adapted for server type. Here is an implementation for IIS.
    The 3 first retrieve settings from web.config.
    AppPath retreive the IIS Chat application virtual path.

*@
<script type="text/javascript">
    // Get appsetting IsTraceEnable for js.
    function IsTraceEnable() {
        return '@Utils.GetAppSetting("IsTraceEnable")';
    }
    // Get appsetting IsConsoleLoggingEnable for js.
    function IsConsoleLoggingEnable() {
        return '@Utils.GetAppSetting("IsConsoleLoggingEnable")';
    }
    // Get appsetting IsDemo for js.
    function IsDemo() {
        return '@Utils.GetAppSetting("IsDemo")';
    }
    // Get IIS application virtual path for js.
    function AppPath() {
        var a = '@HttpContext.Current.Request.ApplicationPath';
        if (a == '/') {
            appPath = '';
        }
        else {
            appPath = a;
        }
        return appPath;
    }
</script>

@*Template for div: text value parameters*@
<script id="new-divmessval-template" type="text/x-jquery-tmpl">
    <div class="message"><strong>${text}:</strong> ${value} </div>
</script>

<script id="new-pmessage-template" type="text/x-jquery-tmpl">
    @*<p id="${Id}" class="${myClass}">
        <img class="img-circle" style="float: left; padding-right:5px" height="35" width="35" src="${imagePath}" />
        <strong> [ ${MessageDateTime} - ${UserName} ]</strong> {{html encodedMessage}}
    </p>*@
    <div id="${Id}" class="${myClass}">
        <img class="img-circle" style="float: left; padding-right:5px" height="35" width="35" src="${imagePath}" title="${UserName}" />
        <strong> [ ${MessageDateTime} - ${UserName} ]</strong> {{html encodedMessage}}
    </div>
</script>


<script id="new-audio-template" type="text/x-jquery-tmpl">
    <audio id="${id}">
        <source src="${appPath}/Content/app/${filename}.ogg" type="audio/ogg">' + '
        <source src="${appPath}/Content/app/${filename}.mp3" type="audio/mp3">' + '
        <source src="${appPath}/Content/app/${filename}.wav" type="audio/wav">' + '
    </audio>'
</script>

<script id="new-private-template" type="text/x-jquery-tmpl">
    <div class="panel panel-default panelScrollDown1 divHide" id=Private_List_Panel_${id}>
        <div id=Private_List_${id}>
        </div>
    </div>
    <div class="input-group" id=Private_Input_${id}>
        <span class="input-group-addon" id="basic-addon2"><span class="glyphicon glyphicon-pencil"></span>&nbsp;To&nbsp;<strong><span>${name}</span></strong></span>
        <input type="text" class="form-control" placeholder="Your message here..." id="txtPrivateMessage_${id}" />
        <div class="input-group-btn">
            <div class="btn-group btn-group" role="group"><button class="btn btn-warning" type="button" id="btnSendMessage_${id}" value="Send">Send private</button></div>
            <div class="btn-group btn-group" role="group"><button class="btn btn-danger" type="button" id="btnClosePrivate_${id}" value="Send">Close private</button></div>
        </div>
    </div>
</script>

<script id="new-adduser-template" type="text/x-jquery-tmpl">
    <p id="${connectionId}" class="${theClass}" style="{{html theStyle}}" title="${theTitle}"><img class="img-circle" style="float: left; padding-right:5px" height="35" width="35" src="${imagePath}" />${name}</p>
</script>

<script id="new-admintable-template" type="text/x-jquery-tmpl">
    <tr><td>${id}</td><td>${name}</td><td>${connectionDateTime}</td><td>{{html message}}</td><td>${messageDateTime}</td></tr>
</script>


